Popular Searches
Popular Course Categories
Popular Courses

React Native Architecture and Core Concepts

React Native Architecture and Core Concepts

Introduction to React Native

React Native Architecture and Core Concepts

Course: React Native Training

Topic: React Native Architecture and Core Concepts

Course Link: React Native Training at JustAcademy

Demo Registration Link: Register for a Course Demo

JustAcademy Website: Visit JustAcademy


1. Introduction to React Native Architecture

React Native is an open-source framework for building mobile applications using React and JavaScript or TypeScript. It allows developers to create interfaces using reusable components while accessing native platform capabilities on Android and iOS.

React Native architecture describes how application code, the React rendering system, the JavaScript runtime, native platform components, and native modules work together to create a mobile application.

Understanding this architecture helps developers write maintainable code, debug application issues, integrate device features, and make informed performance decisions.

1.1 What Is React Native Architecture?

React Native architecture is the collection of systems and components responsible for executing JavaScript code, managing React components, calculating layouts, rendering native user interfaces, and communicating with Android or iOS functionality.

At a high level, a React Native application includes:

  • Application code written with JavaScript or TypeScript.
  • React components that describe the interface.
  • A JavaScript engine that executes application logic.
  • A renderer that coordinates the creation and updating of UI elements.
  • Native platform views that display the interface.
  • Native modules that provide access to platform capabilities.
  • Build tools and development tools used to create and debug the application.

1.2 Why Is Architecture Important?

A clear understanding of architecture helps developers understand what happens when a user interacts with an application.

  • It explains how JavaScript code updates the user interface.
  • It helps developers identify rendering and performance issues.
  • It supports better separation of responsibilities.
  • It clarifies how native device features are accessed.
  • It helps developers choose suitable libraries and project structures.
  • It supports debugging and maintenance in larger applications.

2. Overview of React Native Architecture

React Native uses React to describe the interface and a rendering system to connect that description to native platform views. The exact internal implementation depends on the React Native version and architecture configuration.

The modern React Native architecture uses components such as the JavaScript Interface (JSI), Fabric renderer, and TurboModules. These systems improve communication between JavaScript and native code and support more flexible rendering and native integrations.

2.1 High-Level Architecture Diagram

+--------------------------------------+
|          Application Layer            |
| Screens, Components, Hooks, State     |
+--------------------------------------+
                   |
                   v
+--------------------------------------+
|          React and JavaScript         |
| JSX, Props, State, Business Logic     |
+--------------------------------------+
                   |
                   v
+--------------------------------------+
|          React Native Core            |
| Renderer, Events, Layout, Modules     |
+--------------------------------------+
                   |
                   v
+--------------------------------------+
|        Native Platform Layer          |
| Android Views / iOS Views / APIs      |
+--------------------------------------+
                   |
                   v
+--------------------------------------+
|          Device and Operating         |
| System Capabilities                   |
+--------------------------------------+

This is a simplified conceptual diagram, not a strict representation of every internal execution path. In the modern architecture, the renderer and native modules use shared infrastructure such as JSI and C++ components to communicate with platform code.

2.2 Main Layers of the Architecture

Layer Purpose Examples
Application layer Contains screens and application features. Login screen, product list, profile.
React layer Describes the interface and manages component updates. Components, props, state, hooks.
JavaScript runtime Executes JavaScript application code. Hermes or another supported engine.
Renderer layer Coordinates UI rendering and updates. Fabric renderer.
Native module layer Connects JavaScript to platform capabilities. Camera, storage, notifications.
Platform layer Provides native views and operating-system APIs. Android and iOS frameworks.

3. The JavaScript Layer

The JavaScript layer contains most of the application code written by the developer. It includes components, business rules, state management, API requests, event handlers, and other application logic.

Developers commonly use JavaScript or TypeScript with JSX to describe user interfaces.

3.1 JavaScript and TypeScript

JavaScript is the primary language used in many React Native projects. TypeScript extends JavaScript with static typing and additional development-time checks.

Both languages can be used to create:

  • Reusable components.
  • Application screens.
  • Form validation logic.
  • API communication functions.
  • State-management logic.
  • Navigation and event-handling code.

3.2 Example of a JavaScript Component

import React from 'react';
import { View, Text } from 'react-native';

export default function WelcomeScreen() {
  return (
    <View>
      <Text>Welcome to React Native</Text>
    </View>
  );
}

The component returns a description of the interface. React Native's rendering system uses this description to create the corresponding native interface elements.

3.3 Business Logic

Business logic describes how an application behaves according to its requirements. It may include calculating prices, validating forms, applying discounts, filtering products, or deciding whether an action is permitted.

Keeping business logic separate from presentation components makes applications easier to test and maintain.

4. React and the Component Model

React is the library used to build the component-based interface in React Native. It lets developers divide a user interface into small units and combine them into larger screens.

4.1 What Is a Component?

A component is a reusable function or class that describes part of the user interface. Modern React Native applications commonly use function components and hooks.

Examples include:

  • Header components.
  • Navigation components.
  • Login forms.
  • Product cards.
  • Search fields.
  • Loading indicators.

4.2 Component Composition

Component composition means building a larger interface by combining smaller components. A shopping screen, for example, might contain a header, search bar, product list, and bottom navigation.

function ShoppingScreen() {
  return (
    <View>
      <Header />
      <SearchBar />
      <ProductList />
      <BottomNavigation />
    </View>
  );
}

In this example, each component is responsible for a particular part of the screen. The components must be defined or imported before this screen can run.

4.3 Advantages of Component-Based Development

  • Encourages code reuse.
  • Improves code organization.
  • Makes components easier to test independently.
  • Supports consistent visual design.
  • Allows teams to divide work into manageable features.

5. JSX and React Elements

JSX is a syntax extension that lets developers write markup-like expressions inside JavaScript. React Native developers use JSX to describe components and their relationships.

5.1 JSX Example

import React from 'react';
import { View, Text } from 'react-native';

export default function App() {
  const username = 'Aarav';

  return (
    <View>
      <Text>Hello, {username}!</Text>
    </View>
  );
}

The expression {username} inserts a JavaScript value into the text content.

5.2 React Elements

A React element is a lightweight description of what React should render. JSX expressions are transformed into JavaScript expressions that create these element descriptions.

React uses the element descriptions and component logic to determine what the interface should look like. React Native then coordinates rendering to the native platform rather than creating browser DOM elements.

6. Props and State

Props and state are fundamental concepts in React Native. They control the data displayed by components and determine how the interface responds to changes.

6.1 Props

Props are values passed from a parent component to a child component. They allow components to receive information and behave differently depending on the supplied values.

function Greeting({ name }) {
  return <Text>Hello, {name}!</Text>;
}

function App() {
  return <Greeting name="Aarav" />;
}

The Greeting component receives the name prop and displays it.

6.2 State

State stores information that can change while a component is being used. Examples include whether a menu is open, which tab is selected, the text entered in a field, or whether a request is loading.

import React, { useState } from 'react';
import { View, Text, Pressable } from 'react-native';

export default function Counter() {
  const [count, setCount] = useState(0);

  return (
    <View>
      <Text>Count: {count}</Text>
      <Pressable onPress={() => setCount(value => value + 1)}>
        <Text>Increase</Text>
      </Pressable>
    </View>
  );
}

When the user presses the control, the state changes and React updates the affected interface.

6.3 Props vs State

Feature Props State
Purpose Pass data into a component. Store changing data.
Typical source Parent component. Component or state-management logic.
Example Button title. Selected tab.
Effect Configures component behavior. Can trigger a re-render when updated.

7. Core React Native Components

React Native provides core components that represent common interface elements. These components are the basic building blocks of mobile screens.

Component Purpose Example
View Container and layout element. Card or screen section.
Text Displays text. Heading or description.
Image Displays image content. Product photo.
TextInput Accepts text input. Login form.
Pressable Handles press interactions. Custom button.
ScrollView Provides a scrollable container. Long content screen.
FlatList Displays scrollable lists efficiently. Message or product list.
ActivityIndicator Displays a loading indicator. Waiting for API data.

7.1 Native Components

React Native components are connected to native platform views. For example, a View can correspond to a native container on Android or an appropriate native view on iOS.

This design lets developers write a shared component interface while React Native handles the platform-specific rendering implementation.

8. The JavaScript Runtime and Hermes

The JavaScript runtime executes the JavaScript code used by the application. React Native supports Hermes, a JavaScript engine designed with React Native workloads in mind. Other runtime arrangements may be available depending on the project configuration.

8.1 Responsibilities of the JavaScript Runtime

  • Executes application JavaScript.
  • Runs event handlers and application logic.
  • Evaluates component functions.
  • Processes many state updates and callbacks.
  • Works with React and React Native APIs.

8.2 What Is Hermes?

Hermes is an open-source JavaScript engine optimized for React Native applications. It is designed to support mobile application performance and resource efficiency.

Potential benefits can include improved startup behavior and memory characteristics, depending on the application, build configuration, and workload.

8.3 Why Runtime Choice Matters

The JavaScript engine can influence application startup, memory usage, and JavaScript execution performance. However, overall performance also depends on rendering, native work, networking, application design, and device capabilities.

9. The Rendering System

The renderer converts React's description of the interface into native platform views and coordinates updates when application data changes.

Modern React Native applications use the Fabric renderer as part of the New Architecture.

9.1 What Is Fabric?

Fabric is React Native's modern rendering system. It coordinates React rendering with the native platform and uses shared C++ infrastructure to support rendering operations.

Fabric is designed to improve interoperability between React and native views and support modern React rendering capabilities.

9.2 Responsibilities of the Renderer

  • Processes updates to the component tree.
  • Coordinates the creation and updating of UI elements.
  • Works with layout calculations.
  • Coordinates changes to native views.
  • Supports interaction between React and native rendering systems.

9.3 React Element Tree and Shadow Tree

The React element tree describes the interface from the JavaScript side. Fabric creates and manages a corresponding shadow tree containing information needed to render host components.

The shadow tree represents native-rendering elements and their properties, including information used for layout. It is an internal implementation detail rather than a tree that application developers usually manipulate directly.

10. The Render Pipeline: Render, Commit, and Mount

In the New Architecture, the rendering process is commonly described in three phases: render, commit, and mount. These phases explain how React's component descriptions become visible native UI elements.

10.1 Phase One: Render

During the render phase, React evaluates components and creates the next description of the interface. The renderer also builds or updates the corresponding shadow-tree representation.

For example, when a product quantity changes from one to two, React calculates the new interface that should display the updated quantity.

10.2 Phase Two: Commit

During the commit phase, the next tree is committed, and layout calculations are scheduled or performed as required. React Native uses Yoga for many layout calculations.

The layout system determines the size and position of elements based on their styles and available space.

10.3 Phase Three: Mount

During the mount phase, the renderer applies the necessary changes to the native platform views. These changes can include creating, updating, or removing views.

The result is the visible interface presented to the user.

Phase Main Activity Result
Render Evaluates React components and prepares the next UI representation. Updated element and shadow-tree descriptions.
Commit Commits the next tree and coordinates layout calculations. Committed UI structure and layout information.
Mount Applies required changes to native views. Updated visible interface.

These phases may involve different threads depending on the work being performed. Developers should treat this as a conceptual model rather than assuming every update always runs synchronously on one thread.

11. JavaScript Interface (JSI)

JavaScript Interface, commonly called JSI, is a foundational part of the New Architecture. It provides an interface between a JavaScript runtime and C++ objects, enabling JavaScript and native-side code to interact without relying on the old bridge's serialization model for every interaction.

11.1 Why Was JSI Introduced?

The legacy architecture commonly used an asynchronous bridge to exchange serialized messages between JavaScript and native code. This model could add overhead for some types of communication.

JSI allows direct references to suitable C++ objects from JavaScript, helping reduce certain communication and serialization costs.

11.2 Benefits of JSI

  • Enables more direct JavaScript-to-C++ interaction.
  • Supports modern native-module and rendering designs.
  • Can reduce overhead for suitable native interactions.
  • Helps libraries expose complex native functionality.
  • Provides a foundation for TurboModules and Fabric integration.

11.3 JSI and Performance

JSI can reduce specific types of communication overhead, but it does not automatically make every application faster. Performance depends on how the application uses the architecture and where its actual bottlenecks occur.

12. The Legacy Bridge and the New Architecture

React Native's earlier architecture relied heavily on a bridge that carried asynchronous messages between JavaScript and native code. The New Architecture introduces JSI-based communication and modern rendering and native-module systems.

Aspect Legacy Architecture New Architecture
JavaScript/native communication Relied on an asynchronous serialized bridge for many interactions. Uses JSI-based interfaces for direct interaction with suitable native objects.
Renderer Legacy renderer. Fabric renderer.
Native modules Legacy native-module system. TurboModules and modern native-module infrastructure.
React capabilities Had limitations for certain modern concurrent features. Supports modern React rendering capabilities.
Layout and updates Had limitations in certain synchronous layout scenarios. Enables improved coordination for supported layout and rendering workflows.

The New Architecture became enabled by default in new React Native projects starting with React Native 0.76. Existing applications may have different configurations depending on their version and migration history.

13. Fabric Renderer

Fabric is the rendering system used by React Native's New Architecture. It improves the integration between React's rendering process and native platform views.

13.1 Main Responsibilities

  • Coordinates React rendering with native views.
  • Uses a shared C++ core for important rendering operations.
  • Supports improved interaction between React and native UI.
  • Works with layout calculation and view updates.
  • Supports modern React rendering features.

13.2 Why Fabric Matters

Fabric helps address limitations in the legacy renderer and provides a foundation for more flexible rendering. It is particularly relevant to library developers and teams building applications with specialized native UI integrations.

14. TurboModules and Native Modules

Native modules allow JavaScript code to access native platform functionality. Examples include device information, secure storage, notifications, camera access, and other platform capabilities.

14.1 What Are Native Modules?

A native module is an implementation that exposes platform functionality to React Native application code. Depending on the feature, it may call Android or iOS APIs directly or wrap an existing native SDK.

14.2 What Are TurboModules?

TurboModules are part of React Native's New Architecture for native modules. They use modern infrastructure and can use code generation to improve type safety and integration between JavaScript specifications and native implementations.

14.3 Benefits of TurboModules

  • Provide modern native-module integration.
  • Support typed specifications and code generation.
  • Can initialize modules lazily where appropriate.
  • Improve integration with the New Architecture.
  • Allow applications and libraries to expose native capabilities.

14.4 Example Use Cases

  • Camera access.
  • Location services.
  • Biometric authentication.
  • Secure device storage.
  • Native payment SDKs.
  • Specialized hardware integrations.

Most application developers can use existing compatible libraries without writing a custom native module. Custom native development becomes relevant when a required capability is unavailable or a specialized integration is necessary.

15. Yoga Layout Engine

Yoga is a cross-platform layout engine used by React Native to calculate the size and position of many interface elements. It supports Flexbox-style layout rules, helping applications arrange content across different screen sizes.

15.1 Responsibilities of Yoga

  • Calculates dimensions and positions for supported layout nodes.
  • Processes layout-related style properties.
  • Helps create responsive layouts.
  • Supports consistent layout behavior across supported platforms.

15.2 Example of Flexbox Layout

import React from 'react';
import { View, Text, StyleSheet } from 'react-native';

export default function LayoutExample() {
  return (
    <View style={styles.container}>
      <View style={styles.box}>
        <Text>Box One</Text>
      </View>
      <View style={styles.box}>
        <Text>Box Two</Text>
      </View>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    flexDirection: 'row',
    justifyContent: 'space-around',
    alignItems: 'center'
  },
  box: {
    padding: 20,
    backgroundColor: '#dbeafe',
    borderRadius: 8
  }
});

In this example, the parent container arranges its children in a row. Yoga calculates the layout according to the available space and specified styles.

16. Threads and Execution Model

React Native uses different execution contexts for JavaScript, native UI work, and other tasks. The exact threading model depends on the operation and the platform.

16.1 JavaScript Thread

The JavaScript runtime executes application JavaScript, evaluates component logic, and handles many application events. Long-running synchronous JavaScript work can delay JavaScript processing and affect responsiveness.

16.2 Main or UI Thread

The platform's main or UI thread handles important native interface operations. Keeping expensive work off this thread helps maintain responsive interactions and smooth visual updates.

16.3 Background Work

Some native operations, layout work, or other tasks can be performed on different threads depending on the subsystem and implementation. Developers should avoid assuming that all React Native work runs on a single thread.

16.4 Performance Best Practices

  • Avoid expensive synchronous JavaScript operations during interactions.
  • Use efficient list components for large data sets.
  • Optimize rendering and avoid unnecessary updates.
  • Use suitable animation techniques.
  • Profile real devices and release builds.
  • Investigate actual bottlenecks before optimizing.

17. Events and User Interactions

React Native components can respond to events such as presses, text changes, scrolling, and layout changes. Event handlers connect user actions to application logic.

17.1 Example of Event Handling

import React, { useState } from 'react';
import { View, Text, Pressable } from 'react-native';

export default function InteractionExample() {
  const [message, setMessage] = useState('Ready');

  return (
    <View>
      <Text>{message}</Text>
      <Pressable onPress={() => setMessage('Button pressed!')}>
        <Text>Press Here</Text>
      </Pressable>
    </View>
  );
}

When the user presses the control, the event handler updates state. React then renders the updated message.

17.2 Common Events

  • onPress for press interactions.
  • onChangeText for text input changes.
  • onScroll for scroll activity.
  • onLayout for layout measurements.
  • onFocus and onBlur for input focus changes.

18. API Communication and Data Flow

Most mobile applications communicate with backend services to retrieve or save data. React Native applications can use fetch() or compatible networking libraries to make HTTP requests.

18.1 Typical API Data Flow

  1. The user opens a screen or performs an action.
  2. The application starts a network request.
  3. The backend processes the request.
  4. The server returns a response.
  5. The application validates and processes the response.
  6. State is updated with the result.
  7. React renders the updated interface.

18.2 Example API Function

async function fetchUser() {
  try {
    const response = await fetch(
      'https://jsonplaceholder.typicode.com/users/1'
    );

    if (!response.ok) {
      throw new Error('Request failed');
    }

    return await response.json();
  } catch (error) {
    console.error('Unable to load user:', error);
    return null;
  }
}

This function demonstrates a basic request. Production applications should also handle loading states, authentication, data validation, network failures, and appropriate user-facing error messages.

19. Application Architecture and Project Structure

A good project structure separates screens, reusable components, services, state management, and utility functions. This organization makes applications easier to navigate and maintain as they grow.

19.1 Example Project Structure

ReactNativeApp/
  src/
    components/
      CustomButton.js
      Header.js
      LoadingIndicator.js
    screens/
      HomeScreen.js
      LoginScreen.js
      ProfileScreen.js
    navigation/
      AppNavigator.js
    services/
      api.js
      authService.js
    hooks/
      useUser.js
    context/
      AuthContext.js
    utils/
      validation.js
      formatDate.js
  App.js

19.2 Purpose of Each Folder

Folder or File Purpose
components/ Reusable UI elements.
screens/ Application screens.
navigation/ Navigation configuration.
services/ API and external-service logic.
hooks/ Reusable custom React hooks.
context/ Shared context-based state.
utils/ Reusable helper functions.
App.js Application entry component in this example.

This is an example structure rather than a mandatory convention. Larger applications may use feature-based folders or other architectural patterns.

20. State Management Concepts

State management determines how application data is stored, updated, and shared between components.

20.1 Local Component State

Local state is appropriate for data used by a single component, such as whether a dropdown is open or what text appears in an input field.

20.2 Context API

React Context allows values to be shared across a component tree without passing props through every intermediate component. It can be useful for themes, authentication information, or other shared state when appropriate.

20.3 Reducers and External Libraries

Reducers and external state-management libraries can help manage complex updates and shared application data. They should be introduced when the application's needs justify their added complexity.

20.4 Choosing a State Management Approach

  • Use local state for simple, component-specific information.
  • Use Context for suitable shared values.
  • Use reducers for related state transitions that benefit from centralized logic.
  • Consider an external library for complex shared state or specialized workflows.

21. Navigation Architecture

Navigation manages how users move between screens. React Native applications commonly use navigation libraries to implement stack navigation, tab navigation, drawer navigation, and deep linking.

21.1 Common Navigation Patterns

  • Stack navigation: Moves forward to a screen and back to previous screens.
  • Tab navigation: Switches between major application sections.
  • Drawer navigation: Provides a side navigation menu.
  • Deep linking: Opens a specific screen from a supported external link.

21.2 Why Navigation Architecture Matters

Good navigation architecture makes user journeys predictable and helps manage authentication flows, screen parameters, navigation history, and links to specific application screens.

22. Development Tools and Build System

React Native applications rely on a collection of development and build tools. The exact tools depend on whether the project uses a framework such as Expo or a more directly managed native workflow.

22.1 Metro

Metro is the JavaScript bundler commonly used in React Native development. It processes application JavaScript and related assets to produce bundles for the application.

22.2 Android Studio

Android Studio provides Android development tools, emulators, native build support, and debugging capabilities for Android applications.

22.3 Xcode

Xcode provides iOS development tools, simulators, native build support, and debugging capabilities on supported macOS systems.

22.4 Expo

Expo is a framework and tooling ecosystem built around React Native. It can simplify project setup, development workflows, native-module access, and application delivery.

22.5 React Native DevTools

React Native DevTools helps developers debug supported React Native applications, inspect application behavior, and investigate issues during development.

23. Security Considerations in React Native Architecture

Application architecture should include security practices from the beginning. Mobile applications often process personal information, authentication tokens, payment-related information, and API responses.

  • Use secure transport such as HTTPS for network communication.
  • Avoid embedding secrets or private server credentials in application code.
  • Use suitable secure storage for sensitive device-side information.
  • Validate important data on the server, not only in the client.
  • Request only the device permissions necessary for the application.
  • Keep dependencies updated and review security advisories.
  • Protect authentication and session-management flows.
  • Avoid logging passwords, tokens, or sensitive user information.
  • Review native modules and third-party SDKs before integrating them.

24. Advantages of Understanding React Native Architecture

  • Helps developers understand how interface updates occur.
  • Improves debugging and problem-solving.
  • Supports better component and project design.
  • Clarifies JavaScript-to-native communication.
  • Helps developers understand Fabric, JSI, and TurboModules.
  • Supports informed performance optimization.
  • Makes native integration easier to reason about.
  • Helps teams plan scalable application structures.
  • Improves understanding of testing and build workflows.

25. Common Architecture Mistakes

25.1 Putting All Code in One Component

Large components that combine interface rendering, API requests, validation, and business logic become difficult to maintain. Split responsibilities into reusable components and services.

25.2 Updating State Incorrectly

React state should be updated using the appropriate state setter or state-management mechanism. Avoid directly mutating state objects or arrays.

25.3 Ignoring Platform Differences

Do not assume every UI element, permission, native API, or library behaves identically on Android and iOS. Test both platforms.

25.4 Using Too Many Dependencies

Adding unnecessary libraries can increase application complexity and create compatibility or security risks. Choose dependencies carefully.

25.5 Ignoring Performance Profiling

Do not optimize based only on assumptions. Measure performance and identify actual bottlenecks before changing application architecture.

25.6 Confusing the Legacy Bridge with JSI

The legacy bridge and JSI represent different approaches to JavaScript/native communication. Understanding the difference helps developers interpret documentation and evaluate architecture-related libraries.

26. Frequently Asked Interview Questions and Answers

Q1. What is React Native architecture?

Answer: React Native architecture describes how JavaScript application code, React components, the renderer, native modules, and platform APIs work together to build and run a mobile application.

Q2. What are the main parts of React Native architecture?

Answer: Important parts include the JavaScript runtime, React components, Fabric renderer, JSI, native modules, platform views, and supporting build and development tools.

Q3. What is JSX?

Answer: JSX is a JavaScript syntax extension that lets developers describe React elements using markup-like syntax.

Q4. What is the difference between props and state?

Answer: Props are values passed into a component, while state stores changing data managed by a component or state-management logic.

Q5. What is Hermes?

Answer: Hermes is a JavaScript engine optimized for React Native workloads. Its effect on startup and runtime performance depends on the application and configuration.

Q6. What is Fabric?

Answer: Fabric is React Native's modern rendering system. It coordinates React's rendering process with native platform views.

Q7. What is JSI?

Answer: JSI is an interface that enables interaction between a JavaScript runtime and suitable C++ objects, supporting the New Architecture's approach to JavaScript/native communication.

Q8. What are TurboModules?

Answer: TurboModules are part of the New Architecture's native-module system. They support modern integration patterns and can use code generation for typed interfaces.

Q9. What is the purpose of Yoga?

Answer: Yoga is a layout engine that calculates the size and position of many React Native interface elements using Flexbox-style layout rules.

Q10. What are render, commit, and mount?

Answer: Render prepares the next interface description, commit coordinates committing the tree and layout calculations, and mount applies the required changes to native views.

Q11. What is the difference between the legacy architecture and the New Architecture?

Answer: The legacy architecture relied on an asynchronous bridge for many JavaScript/native interactions and used the legacy renderer and module system. The New Architecture introduces JSI-based interfaces, Fabric, and TurboModules.

Q12. What is Metro?

Answer: Metro is the JavaScript bundler commonly used in React Native projects to process application code and assets.

Q13. Why is component-based architecture useful?

Answer: It encourages reusable code, improves organization, simplifies testing, and makes larger applications easier to maintain.

Q14. Does understanding the New Architecture automatically make an app faster?

Answer: No. The New Architecture enables improved capabilities, but performance depends on application code, native work, rendering patterns, dependencies, and actual bottlenecks.

27. Practical Exercises

  1. Draw a high-level diagram of React Native architecture.
  2. Create a component that displays a greeting using props.
  3. Create a counter using useState.
  4. Build a profile screen using View, Text, and Image.
  5. Explain how the JavaScript runtime participates in application execution.
  6. Describe the roles of Fabric, JSI, and TurboModules.
  7. Explain the render, commit, and mount phases.
  8. Create a sample project structure that separates screens, components, and services.
  9. Fetch sample data from an API and display it in a list.
  10. Identify potential performance problems in a large list screen.
  11. Compare the legacy architecture with the New Architecture.
  12. Explain why applications need testing on both Android and iOS.

28. Quick Revision Checklist

  • Understand React Native architecture and its purpose.
  • Know the roles of JavaScript and React.
  • Understand JSX, components, props, and state.
  • Identify common React Native core components.
  • Understand the JavaScript runtime and Hermes.
  • Know the purpose of Fabric.
  • Understand JSI and its role in native communication.
  • Know what TurboModules provide.
  • Understand Yoga and layout calculations.
  • Explain the render, commit, and mount phases.
  • Understand native modules and device integration.
  • Know the roles of Metro, Android Studio, Xcode, and Expo.
  • Understand basic state management and navigation architecture.
  • Recognize common architecture mistakes and security considerations.

29. Recommended Learning Resources

30. Conclusion

React Native architecture explains how application code written with React and JavaScript or TypeScript connects to native mobile interfaces and platform capabilities. Its core concepts include components, JSX, props, state, the JavaScript runtime, the rendering pipeline, Fabric, JSI, TurboModules, Yoga, and native modules.

Understanding these concepts helps developers organize projects, manage application data, build reusable interfaces, troubleshoot rendering problems, and integrate native features. A good architecture also requires appropriate state management, navigation, security practices, performance profiling, and testing across platforms.

By learning React Native architecture and core concepts, developers can build a strong foundation for creating maintainable Android and iOS applications.

Explore the Course: Visit JustAcademy React Native Training for course information, or use the course demo registration page.

whatsapp